package com.ymttest.database.sqlwapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.AccountEntry;
import com.ymttest.database.model.Ymt_BondedArea;
import com.ymttest.database.model.Ymt_ExpressCountryToMode;
import com.ymttest.utils.EnvSetup;

/************************************************************************************
 * @File name : Ymt_ExpressCountryToModeWapper.java
 * @Author : zhouyi
 * @Date : 2015年4月2日
 * @Copyright : 洋码头
 ************************************************************************************/
public class Ymt_BondedAreaWapper {
	SqlManager manage;

	public Ymt_BondedAreaWapper() {
		manage = new SqlManager("ymt" + EnvSetup.getEnv());
	}

	public List<Ymt_BondedArea> selectByCatalogStatus(int catalogStatus)
	{
		Map m = new HashMap();
		m.put("catalogStatus", catalogStatus);
		List<Ymt_BondedArea> pia = manage.getSelectResults("com.ymttest.database.mapping.Ymt_BondedAreaMapper.selectByCatalogStatus", m);
		manage.commit();
		return pia;
	}
		
	public int insert(Ymt_BondedArea record)
			throws InterruptedException {
		int result= manage
				.insert(
						"com.ymttest.database.mapping.Ymt_BondedAreaMapper.insert",
						record);
		manage.commit();
		return result;
	}
	
	
	public int updateBySellerIdAndStatus(int userId,int catalogStatus,int bondedAreaId,int action)
	{
		Map m = new HashMap();
		m.put("userId", userId);
		m.put("catalogStatus", catalogStatus);
		m.put("bondedAreaId", bondedAreaId);
		m.put("action", action);
		int result= manage
				.update(
						"com.ymttest.database.mapping.Ymt_BondedAreaMapper.updateBySellerIdAndStatus",
						m);
		manage.commit();
		return result;
    }

	public static void main(String args[]) {
		System.out.println(new Ymt_BondedAreaWapper().updateBySellerIdAndStatus(3383,4, 1, 1));
	}
}
